package com.moli.iov.handle.alarm.enums;

import java.util.HashSet;
import java.util.Set;

/**
 * <p>
 *  报警状态
 * </p>
 *
 * @author: zql
 * @Date: 2019/2/14 10:05
 */
public enum AlarmStatusEnum {

    /**
     * 报警中
     */
    ALARMING(1, "报警中"),

    /**
     * 已解除
     */
    ALARM_END(2, "已解除"),

    /**
     * 已忽略
     */
    IGNORE(3, "已忽略");

    private int flag;

    private String msg;

    AlarmStatusEnum(int flag, String msg){
        this.flag = flag;
        this.msg = msg;
    }

    public static String getMsg(int flag){
        for(AlarmStatusEnum e : AlarmStatusEnum.values()){
            if(e.flag == flag){
                return e.msg;
            }
        }
        return "";
    }

    public static Set<Integer> getAlarmStatus() {
        Set<Integer> set = new HashSet<>();
        for(AlarmStatusEnum e:AlarmStatusEnum.values()){
            if(e.flag!=3){
                set.add(e.flag);
            }
        }
        return set;
    }

    public int getFlag() {
        return flag;
    }

    public String getMsg() {
        return msg;
    }

}
